package com.example.springwebmvcdemo.controller;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/hello")
public class HelloController {
    //RequestMapping默认为get请求
    @RequestMapping(value = "/v1")
    public String v1() {
        return "hello v1";
    }

    //GetMapping只支持get请求
    @GetMapping("/v2")
    public String v2() {
        return "hello v2";
    }

    //在method中修改请求方法
    @RequestMapping(value = "/v3",method = RequestMethod.POST)
    public String v3() {
        return "hello v3";
    }

    //PostMapping只支持post请求
    @PostMapping("/v4")
    public String v4() {
        return "hello v4";
    }
}
